// Copyright Dotware Technologies 2005. Author Hadi Asghari.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace dwDbfViewer
{
	/// <summary>
	/// Summary description for FormGoto.
	/// </summary>
	public class FormGoto : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnClose;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox txtGoto;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public FormGoto()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.btnClose = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.txtGoto = new System.Windows.Forms.TextBox();
			this.SuspendLayout();
			// 
			// btnClose
			// 
			this.btnClose.Location = new System.Drawing.Point(84, 64);
			this.btnClose.Name = "btnClose";
			this.btnClose.TabIndex = 0;
			this.btnClose.Text = "Go!";
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(15, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(120, 23);
			this.label1.TabIndex = 1;
			this.label1.Text = "Goto record number:";
			// 
			// txtGoto
			// 
			this.txtGoto.Location = new System.Drawing.Point(127, 24);
			this.txtGoto.Name = "txtGoto";
			this.txtGoto.TabIndex = 2;
			this.txtGoto.Text = "";
			// 
			// FormGoto
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(242, 98);
			this.ControlBox = false;
			this.Controls.Add(this.txtGoto);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.btnClose);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.Name = "FormGoto";
			this.Load += new System.EventHandler(this.FormGoto_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void btnClose_Click(object sender, System.EventArgs e)
		{
			try
			{
				Singleton.Instance().StartRecord = int.Parse(txtGoto.Text);
				if ( Singleton.Instance().StartRecord < 1 )
					Singleton.Instance().StartRecord = 0;
			}
			catch
			{
			}
			this.Close();
		}

		private void FormGoto_Load(object sender, System.EventArgs e)
		{
			txtGoto.Text = Singleton.Instance().StartRecord.ToString();
		}
	}
}
